﻿//===========================[ 7 / 6 / 2011 LVI ]=============================
//				Copyright c Vitaly Lyaschenko <SkyChameleon@gmail.com>
// 								Header file
// Purpose: 
//=============================================================================
#pragma once

#include <Windows.h>
#include "common.h"

class cMouse
{
public:
	cMouse(void);
	~cMouse(void);

	int getXpos() const { return m_XposRelative; }
	int getYpos() const { return m_YposRelative; }

	float getWheel() const { return m_mouseWheel; }

	bool attach( HWND hWnd );
	void detach();
	void hMsg( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
	void hideCursor( bool visible );
	void setPosition( UINT x, UINT y );
	void getPosition( UINT& _x, UINT& _y );
	void update();

private:
	static byte m_tempBuffer[40];

	HWND m_hWnd;

	int m_XposAbsolute,
		m_YposAbsolute,
		m_XposRelative,
		m_YposRelative,
		m_WheelDelta,
	    m_WheelDeltaPrev;

	float m_mouseWheel;
	bool cursorVisible;
	bool buttonStates[2][3];
	bool *pCurrButtonStates;
	bool *pPrevButtonStates;

	POINT m_ptWindowCenterPos;
	POINT m_ptCurrentPos;
};

